﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>添加方法</title>
    @*<link href="~/Content/File/application-6ebab4c9dc68a9c1017b1cb2a87fd1a8.css" media="screen" rel="stylesheet" type="text/css">
    <link href="~/Content/File/application-e92b9e1a0333707046adceb7bbcea4e5.css" media="screen" rel="stylesheet" type="text/css">*@

    <link href="~/Content/Css/addMethod.css" rel="stylesheet" />
    <link data-inline="yes-please" href="~/Content/File/e/index.css" rel="stylesheet">
    <link data-name="vs/editor/editor.main" rel="stylesheet" href="~/Content/File/e/editor.main.css">

</head>
<body class="ui_basic" id="codes-new">
    <input type="hidden" value="" id="method_ID" />
    <div class="ui grid page dimmable" id="index-nav">
        <h4 class="ui top attached header" id="code-edit-form-title">
            <div class="back-float">
                <a href="/">
                    <i class="icon-ic_more-arrow iconfont icon-rotate"></i>
                    <span>返回</span>
                </a>
            </div>
            <div class="title">
                添加方法
            </div>
        </h4>
        <div class="row code_row" id="code-edit-form">
            <div class="column code_column">
                <div class="ui bottom attached segment form">


                    <div class="ui grid middle aligned">
                        <div class="wide column code-label">
                            <label class="string required" for="code_summary">
                                <abbr title="required">*</abbr>
                                方法标题
                            </label>
                        </div>
                        <div class="wide column code-input summary field">
                            <input id="method_Title" class="string required" maxlength="255" name="code[summary]" size="50" type="text">
                            <div class="ui small error text message input-error-msg"></div>
                        </div>
                    </div>

                    <div class="ui grid middle aligned">
                        <div class="wide column code-label">
                            <label class="string required" for="code_summary">
                                <abbr title="required">*</abbr>
                                方法描述
                            </label>
                        </div>
                        <div class="wide column code-input summary field">
                            <input id="method_Desc" class="string required" maxlength="255" name="code[summary]" size="50" type="text">
                            <div class="ui small error text message input-error-msg"></div>
                        </div>
                    </div>


                    @*<div class="ui grid middle aligned">
                        <div class="wide column code-label">
                            <label class="string optional" for="code_tag_list">标签</label>
                        </div>
                        <div class="wide column code-input tags">
                            <input class="string optional tagit-hidden-field" id="code_tag_list" name="code[tag_list]" size="50" type="text"><ul class="tagit ui-widget ui-widget-content ui-corner-all">
                                <li class="tagit-new">
                                    <input id="method_Label" class="ui-widget-content ui-autocomplete-input" placeholder="标签用逗号分隔" autocomplete="off" maxlength="30" type="text"><span role="status" aria-live="polite" class="ui-helper-hidden-accessible"></span>
                                </li>
                            </ul>
                        </div>
                    </div>*@


                    <div class="ui grid middle aligned">
                        <div class="wide column code-label">
                            <label class="string required" for="code_summary">
                                <abbr title="required">*</abbr>
                                输入
                            </label>
                        </div>
                        <div class="wide column code-input summary field">
                            <input id="method_Input" class="string required" maxlength="255" name="code[summary]" size="50" type="text">
                            <div class="ui small error text message input-error-msg"></div>
                        </div>
                    </div>

                    <div class="ui grid middle aligned">
                        <div class="wide column code-label">
                            <label class="string required" for="code_summary">
                                <abbr title="required">*</abbr>
                                输出
                            </label>
                        </div>
                        <div class="wide column code-input summary field">
                            <input id="method_Output" class="string required" maxlength="255" name="code[summary]" size="50" type="text">
                            <div class="ui small error text message input-error-msg"></div>
                        </div>
                    </div>

                    <div>


                        <!--代码编辑器-->
                        <!--<pre data-preload="index/samples/sample.typescript.txt"></pre>
                        <pre data-preload="index/samples/diff.lhs.txt"></pre>
                        <pre data-preload="index/samples/diff.rhs.txt"></pre>-->
                        <!--<a id="gh-link" href="https://github.com/Microsoft/monaco-editor">
                            <img width="149" height="149" alt="Fork me on GitHub" src="./fork.png" />
                        </a>-->
                        <section class="try">
                            <div class="container">

                                <div class="editor row">
                                    <div class="span9">
                                        <div class="row">
                                            <div class="span4">
                                                <label class="control-label">Language</label>
                                                <select class="language-picker" id="method_Language"></select>
                                            </div>
                                            <div class="span4">
                                                <label class="control-label">Theme</label>
                                                <select class="theme-picker">
                                                    <option>Visual Studio</option>
                                                    <option>Visual Studio Dark</option>
                                                    <option>High Contrast Dark</option>
                                                </select>
                                            </div>
                                        </div>
                                        <div class="editor-frame">
                                            <div class="loading editor" style="display: none;">
                                                <div class="progress progress-striped active">
                                                    <div class="bar"></div>
                                                </div>
                                            </div>
                                            <div id="editor"></div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                        </section>
                    </div>

                    <div class="ui grid submit">
                        <div class="wide column code-label"></div>
                        <div class="wide column code-input">
                            <label id="status_msg"></label>
                            <input class="ui button orange js-code-button" name="commit" id="AddMethod" onclick="AddMethod()" value="添加" type="submit">
                            <div class="ui small error message btn-error-msg" style="display: none;"></div>
                        </div>
                    </div>

                </div>
            </div>
        </div>

    </div>

    <script type="text/javascript" src="~/Content/File/e/jquery.min.js"></script>
    <script src="~/Content/File/e/loader.js"></script>
    <script src="~/Content/File/e/editor/editor.main.nls.js"></script>
    <script src="~/Content/File/e/editor/editor.main.js"></script>
    <script src="~/Content/File/e/index.js" type="text/javascript"></script>

    <script>
        function AddMethod() {
            //var cmd = $("#createform").data("cmd");

            var id = $("#method_ID").val();
            var title = $("#method_Title").val();
            var inputValue = $("#method_Input").val();
            var outputVlaue = $("#method_Output").val();
            var languageName = $("#method_Language").val();
            var methodContent = editor.getValue();
            //var tableName = "tb_Method";
            var url = "/Home/Add_Method";
            var data = { "id": id, "title": title, "inputValue": inputValue, "outputVlaue": outputVlaue, "languageID": languageName, "methodContent": methodContent, "tableName": "tb_Method" };
            var type = "POST";

            //if (cmd == "up") {
            //    //url += "/" + id;
            //    type = "PUT";
            //}
            $.ajax({
                url: url,
                type: type,
                data: data ,
                success: function (data) {
                    //$("#createmodal").modal("hide");
                    //load();
                }
            })
        }
    </script>
</body>
</html>
